/*
 * Middleware
 * Copyright (C) 2010/11
 * Riccardo Pulvirenti, Giuseppe Ravidà, Andrea Tino
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANDABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses
 */

/*!
 * File: workflow.cpp
 */

#include "worker_network.hpp"

using namespace middleware;

//-----------------------------------------------------------------------------
// Constructors and destructor
/* Default constructor */
WorkerNetwork::WorkerNetwork() {
	this->_workers.clear();
}
/* Copy constructor */
WorkerNetwork::WorkerNetwork(const WorkerNetwork& wn) {
	this->_workers.clear();
	WorkerNetwork::AddressCollectionConstIterator it;
		for (it = wn._workers.begin(); it < wn._workers.end(); it++)
			(this->_workers).push_back(*it);
}
/* Destructor */
WorkerNetwork::~WorkerNetwork() {
	this->_workers.clear();
}
//-----------------------------------------------------------------------------
// Public members
/* Assigning a set of addresses */
void WorkerNetwork::assign(WorkerNetwork::AddressCollectionConstIterator first,
		WorkerNetwork::AddressCollectionConstIterator last) {
	(this->_workers).clear();
	WorkerNetwork::AddressCollectionConstIterator it;
	for (it = first; it < last; it++) (this->_workers).push_back(*it);
}
/* Pushing back element in container */
void WorkerNetwork::push_back(WorkerNetwork::ConstReference addr) {
	(this->_workers).push_back(addr);
}
/* Indexer */
WorkerNetwork::Reference WorkerNetwork::operator[](WorkerNetwork::SizeType
		position) {
	this->_workers[position];
}
WorkerNetwork::ConstReference WorkerNetwork::operator[](
		WorkerNetwork::SizeType	position) const {
	this->_workers[position];
}
/* Clear */
void WorkerNetwork::clear() {
	(this->_workers).clear();
}
/* Size */
WorkerNetwork::SizeType WorkerNetwork::size() const {
	return (this->_workers).size();
}
/* Empty check */
bool WorkerNetwork::empty() const {
	return (this->_workers).empty();
}
